package com.app.mvvmkotlindemo.request

import androidx.lifecycle.MutableLiveData
import com.app.mvvmkotlindemo.bean.OrderCancleBean
import com.app.mvvmkotlindemo.bean.OrderMakerTimeBean
import com.app.mvvmkotlindemo.bean.OrderSpecialBean
import com.everyline.baselibrary.base.viewmodel.BaseViewModel
import com.everyline.baselibrary.ext.request
import com.everyline.baselibrary.state.ResultState
import com.app.mvvmkotlindemo.network.HttpRequestManger

/**
 * Created by on 2020/12/1.
 * 天天挂线
 *  746608431@qq.com
 *  描述:TODO
 */

class RequestOrderStatusInfoModel : BaseViewModel() {


    var orderSpecialData =
        MutableLiveData<ResultState<OrderSpecialBean?>>()

    var modifyOrderStatusByDriverData =
        MutableLiveData<ResultState<OrderMakerTimeBean?>>()


    var cancelOrderData =
        MutableLiveData<ResultState<OrderCancleBean?>>()


    fun getOrderSpecial(map: Map<String, String>) {
        request(
            { HttpRequestManger.apiService.getOrderSpecial(map) },
            orderSpecialData,
            true
        )
    }


    fun modifyOrderStatusByDriver(map: Map<String, String>) {
        request(
            { HttpRequestManger.apiService.modifyOrderStatusByDriver(map) },
            modifyOrderStatusByDriverData,
            true
        )

    }

    fun cancelOrder(map: Map<String, String>) {
        request(
            { HttpRequestManger.apiService.cancelOrder(map) },
            cancelOrderData,
            true
        )

    }


}